<?php

	$params = file_get_contents("php://input");
 	$_POST = json_decode($params, true);

// 	$startTime = isset($_POST['startTime']) ? $_POST['startTime'] : '2017-10-07';
// 	$endTime = isset($_POST['endTime']) ? $_POST['endTime'] : '2017-10-17';
// 	$page = isset($_POST['page']) ? $_POST['page'] : 1;
// 	$type = isset($_POST['type']) ? $_POST['type'] : 0;
// 	$actId = isset($_POST['actId']) ? $_POST['actId'] : 20201;

 	$url = "http://api.ddoctor.cn/s";

// 	$params = [
//  		"endTime" => $endTime, // "2017-10-17"
//  		"page" => 1,
//  		"startTime" => $startTime, //"2017-10-07",
//  		"type" => 0,
//  		"actId" => 20201,
//  		"clientsn" => "patient",
//  		"doctorId" => 0,
//  		"patientId" => 12129353,
//  		"userType" => 1
// ];
	header("Content-Type:application/json;charset=utf8;");

	$response = post($url, $params);
	echo $response;

    function post($url, $fields)
    {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        //curl_setopt($ch, CURLOPT_ENCODING, 'gzip');
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_NOBODY, 0);
		curl_setopt($ch, CURLOPT_TIMEOUT, 30);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
        $data = curl_exec($ch);
        return $data;
    }